﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ActionService.DataTransferObjects;
using BusinessObjects;
using BusinessObjects.Person;
using BusinessObjects.Production;
using Utils;
using BusinessObjects.HumanResources;
using BusinessObjects.BusinessRules;
using BusinessObjects.Sales;

namespace ActionService.DataTransferObjectMapper
{
    public static class Mapper
    {
        public static UserGroupDto ToDataTransferObject(UserGroup userGroup)
        {
            if (userGroup == null) return null;

            return new UserGroupDto
            {
                UserGroupID = userGroup.UserGroupID,
                UserGroupName = userGroup.UserGroupName,
                Image = userGroup.Image,
                RestaurantID = userGroup.RestaurantID,
                CreateBy = userGroup.CreateBy,
                CreateDate = userGroup.CreateDate,
                ModifiedBy = userGroup.ModifiedBy,
                ModifiedDate = userGroup.ModifiedDate,
                Description = userGroup.Description,
                IsActive = userGroup.IsActive
            };
        }

        public static CountryRegionDto ToDataTransferObject(CountryRegion countryRegion)
        {
            if (countryRegion == null) return null;

            return new CountryRegionDto
            {
                CountryRegionCode = countryRegion.CountryRegionCode,
                CountryRegionName = countryRegion.CountryRegionName,
                CreateDate = countryRegion.CreateDate,
                ModifiedDate = countryRegion.ModifiedDate,
                Description = countryRegion.Description,
                IsActive = countryRegion.IsActive
            };
        }

        public static RestaurantMenuDto ToDataTransferObject(RestaurantMenu restaurantMenu)
        {
            if (restaurantMenu == null) return null;

            return new RestaurantMenuDto
            {
                MenuID = restaurantMenu.MenuID,
                MenuCode = restaurantMenu.MenuCode,
                MenuName = restaurantMenu.MenuName,
                Description = restaurantMenu.Description,
                UnitID = restaurantMenu.UnitID,
                SalesPrice = restaurantMenu.SalesPrice,
                MenuImage = restaurantMenu.MenuImage,
                IsActive = restaurantMenu.IsActive,
                IsNorm = restaurantMenu.IsNorm,
                RestaurantID = restaurantMenu.RestaurantID,
                MenuCategoryID = restaurantMenu.MenuCategoryID
            };
        }

        public static RestaurantDto ToDataTransferObject(Restaurant restaurant)
        {
            if (restaurant == null) return null;

            return new RestaurantDto
            {
                RestaurantID = restaurant.RestaurantID,
                RestaurantCode = restaurant.RestaurantCode,
                RestaurantName = restaurant.RestaurantName,
                Address = restaurant.Address,
                PhoneNumber = restaurant.PhoneNumber,
                Fax = restaurant.Fax,
                Email = restaurant.Email,
                Website = restaurant.Website,
                TaxCode = restaurant.TaxCode,
                IsActive = restaurant.IsActive,
                IsAgencies = restaurant.IsAgencies,
                Description = restaurant.Description
            };
        }

        public static RestaurantMenuNormDto ToDataTransferObject(RestaurantMenuNorm restaurantMenuNorm)
        {
            if (restaurantMenuNorm == null) return null;

            return new RestaurantMenuNormDto
            {
                MenuNormID = restaurantMenuNorm.MenuNormID,
                MenuNormCode = restaurantMenuNorm.MenuNormCode,
                MenuNormName = restaurantMenuNorm.MenuNormName,
                Description = restaurantMenuNorm.Description,
                RestaurantID = restaurantMenuNorm.RestaurantID,
                MenuID = restaurantMenuNorm.MenuID
            };
        }

        public static RestaurantMenuNormDetailDto ToDataTransferObject(RestaurantMenuNormDetail restaurantMenuNormDetail)
        {
            if (restaurantMenuNormDetail == null) return null;

            return new RestaurantMenuNormDetailDto
            {
                MenuNormID = restaurantMenuNormDetail.MenuNormID,
                MenuNormDetailID = restaurantMenuNormDetail.MenuNormDetailID,
                InventoryItemID = restaurantMenuNormDetail.InventoryItemID,
                InventoryItemName = restaurantMenuNormDetail.InventoryItemName,
                UnitID = restaurantMenuNormDetail.UnitID,
                UnitPrice = restaurantMenuNormDetail.UnitPrice,
                RestaurantID = restaurantMenuNormDetail.RestaurantID,
                Quantity = restaurantMenuNormDetail.Quantity
            };
        }

        public static DistrictDto ToDataTransferObject(District district)
        {
            if (district == null) return null;

            return new DistrictDto
            {
                DistrictCode = district.DistrictCode,
                DistrictName = district.DistrictName,
                CreateDate = district.CreateDate,
                ModifiedDate = district.ModifiedDate,
                Description = district.Description,
                IsActive = district.IsActive
            };
        }

        public static CurrencyDto ToDataTransferObject(Currency currency)
        {
            if (currency == null) return null;

            return new CurrencyDto
            {
                CurrencyID = currency.CurrencyID,
                CurrencyCode = currency.CurrencyCode,
                CurrencyName = currency.CurrencyName,
                Description = currency.Description,
                IsActive = currency.IsActive
            };
        }

        public static UnitsDto ToDataTransferObject(Unit unit)
        {
            if (unit == null) return null;

            return new UnitsDto
            {
                UnitID = unit.UnitID,
                UnitCode = unit.UnitCode,
                UnitName = unit.UnitName,
                RestaurantID = unit.RestaurantID,
                Description = unit.Description,
                IsActive = unit.IsActive
            };
        }

        public static InwardOutwardDto ToDataTransferObject(InwardOutward inwardOutward)
        {
            if (inwardOutward == null) return null;

            return new InwardOutwardDto
            {
                RefID = inwardOutward.RefID,
                RefType = inwardOutward.RefType,
                RefDate = inwardOutward.RefDate,
                PostedDate = inwardOutward.PostedDate,
                RefNo = inwardOutward.RefNo,
                EmployeeID = inwardOutward.EmployeeID,
                AccountingObjectID = inwardOutward.AccountingObjectID,
                AccountingObjectName = inwardOutward.AccountingObjectName,
                AccountingObjectAddress = inwardOutward.AccountingObjectAddress,
                JournalMemo = inwardOutward.JournalMemo,
                CurrencyID = inwardOutward.CurrencyID,
                ExchangeRate = inwardOutward.ExchangeRate,
                IsImportPurchase = inwardOutward.IsImportPurchase,
                ShippingMethodID = inwardOutward.ShippingMethodID,
                TotalAmount = inwardOutward.TotalAmount,
                RestaurantID = inwardOutward.RestaurantID,
                IsPosted = inwardOutward.IsPosted,
                IsMaterial = inwardOutward.IsMaterial
            };
        }

        public static InwardOutwardDetailDto ToDataTransferObject(InwardOutwardDetail inwardOutwardDetail)
        {
            if (inwardOutwardDetail == null) return null;

            return new InwardOutwardDetailDto
            {
                RefDetailID = inwardOutwardDetail.RefDetailID,
                RefID = inwardOutwardDetail.RefID,
                RestaurantMenuID = inwardOutwardDetail.RestaurantMenuID,
                InventoryItemID = inwardOutwardDetail.InventoryItemID,
                InventoryItemName = inwardOutwardDetail.InventoryItemName,
                Description = inwardOutwardDetail.Description,
                StockID = inwardOutwardDetail.StockID,
                UnitID = inwardOutwardDetail.UnitID,
                UnitConvertID = inwardOutwardDetail.UnitConvertID,
                Quantity = inwardOutwardDetail.Quantity,
                QuantityConvert = inwardOutwardDetail.QuantityConvert,
                UnitPrice = inwardOutwardDetail.UnitPrice,
                UnitPriceConvert = inwardOutwardDetail.UnitPriceConvert,
                Amount = inwardOutwardDetail.Amount,
                AmountConvert = inwardOutwardDetail.AmountConvert,
                OutwardPurpose = inwardOutwardDetail.OutwardPurpose,
            };
        }

        public static ProvinceDto ToDataTransferObject(Province province)
        {
            if (province == null) return null;

            return new ProvinceDto
            {
                ProvinceCode = province.ProvinceCode,
                ProvinceName = province.ProvinceName,
                CreateDate = province.CreateDate,
                ModifiedDate = province.ModifiedDate,
                Description = province.Description,
                IsActive = province.IsActive
            };
        }

        public static AutoIDDto ToDataTransferObject(AutoID autoId)
        {
            if (autoId == null) return null;

            return new AutoIDDto
            {
                AutoId = autoId.AutoId,
                RefTypeID = autoId.RefTypeID,
                RefTypeName = autoId.RefTypeName,
                Prefix = autoId.Prefix,
                Value = autoId.Value,
                LengthOfValue = autoId.LengthOfValue,
                Suffix = autoId.Suffix,
                RestaurantID = autoId.RestaurantID,
            };
        }

        public static RestaurantAreaDto ToDataTransferObject(RestaurantArea restaurantArea)
        {
            if (restaurantArea == null) return null;

            return new RestaurantAreaDto
            {
                RestaurantAreaID = restaurantArea.RestaurantAreaID,
                RestaurantAreaCode = restaurantArea.RestaurantAreaCode,
                RestaurantAreaName = restaurantArea.RestaurantAreaName,
                RestaurantID = restaurantArea.RestaurantID,
                Description = restaurantArea.Description,
                IsActive = restaurantArea.IsActive
            };
        }

        public static InventoryItemDto ToDataTransferObject(InventoryItem inventoryItem)
        {
            if (inventoryItem == null) return null;

            return new InventoryItemDto
            {
                InventoryItemID = inventoryItem.InventoryItemID,
                InventoryCategoryID = inventoryItem.InventoryCategoryID,
                InventoryItemCode = inventoryItem.InventoryItemCode,
                InventoryItemName = inventoryItem.InventoryItemName,
                UnitID = inventoryItem.UnitID,
                UnitPrice = inventoryItem.UnitPrice,
                SalesPrice = inventoryItem.SalesPrice,
                StockID = inventoryItem.StockID,
                MinimumStock = inventoryItem.MinimumStock,
                IsActive = inventoryItem.IsActive,
                Description = inventoryItem.Description,
                RestaurantId = inventoryItem.RestaurantId,
                IsMaterial = inventoryItem.IsMaterial
            };
        }

        public static StockDto ToDataTransferObject(Stock stock)
        {
            if (stock == null) return null;

            return new StockDto
            {
                StockID = stock.StockID,
                StockCode = stock.StockCode,
                StockName = stock.StockName,
                RestaurantID = stock.RestaurantID,
                Description = stock.Description,
                IsActive = stock.IsActive
            };
        }

        public static ShipMethodDto ToDataTransferObject(ShipMethod shipMethod)
        {
            if (shipMethod == null) return null;

            return new ShipMethodDto
            {
                ShipMethodID = shipMethod.ShipMethodID,
                ShipCode = shipMethod.ShipCode,
                ShipName = shipMethod.ShipName,
                Description = shipMethod.Description,
                IsActive = shipMethod.IsActive
            };
        }

        public static TimeSheetSignDto ToDataTransferObject(TimeSheetSign timeSheetSign)
        {
            if (timeSheetSign == null) return null;

            return new TimeSheetSignDto
            {
                TimeSheetSignID = timeSheetSign.TimeSheetSignID,
                TimeSheetSignCode = timeSheetSign.TimeSheetSignCode,
                TimeSheetSignName = timeSheetSign.TimeSheetSignName,
                SalaryRate = timeSheetSign.SalaryRate,
                Description = timeSheetSign.Description,
                IsActive = timeSheetSign.IsActive
            };
        }

        public static RestaurantMenuCategoryDto ToDataTransferObject(RestaurantMenuCategory restaurantMenuCategory)
        {
            if (restaurantMenuCategory == null) return null;

            return new RestaurantMenuCategoryDto
            {
                MenuCategoryID = restaurantMenuCategory.MenuCategoryID,
                MenuCategoryCode = restaurantMenuCategory.MenuCategoryCode,
                MenuCategoryName = restaurantMenuCategory.MenuCategoryName,
                RestaurantID = restaurantMenuCategory.RestaurantID,
                IsParent = restaurantMenuCategory.IsParent,
                ParentID = restaurantMenuCategory.ParentID,
                Description = restaurantMenuCategory.Description,
                IsActive = restaurantMenuCategory.IsActive
            };
        }

        public static RestaurantTableDto ToDataTransferObject(RestaurantTable restaurantTable)
        {
            if (restaurantTable == null) return null;

            return new RestaurantTableDto
            {
                RestaurantTableID = restaurantTable.RestaurantTableID,
                RestaurantTableCode = restaurantTable.RestaurantTableCode,
                RestaurantTableName = restaurantTable.RestaurantTableName,
                RestaurantID = restaurantTable.RestaurantID,
                RestaurantAreaID = restaurantTable.RestaurantAreaID,
                MaxPeople = restaurantTable.MaxPeople,
                IsOrder = restaurantTable.IsOrder,
                IsOrderOnline = restaurantTable.IsOrderOnline,
                Description = restaurantTable.Description,
                IsActive = restaurantTable.IsActive
            };
        }

        public static AccountingObjectDto ToDataTransferObject(AccountingObject accountingObject)
        {
            if (accountingObject == null) return null;

            return new AccountingObjectDto
            {
                AccountingObjectID = accountingObject.AccountingObjectID,
                AccountingObjectCode = accountingObject.AccountingObjectCode,
                AccountingObjectName = accountingObject.AccountingObjectName,
                AccountingObjectCategoryId = accountingObject.AccountingObjectCategoryId,
                RestaurantId = accountingObject.RestaurantId,
                Prefix = accountingObject.Prefix,
                Address = accountingObject.Address,
                Fax = accountingObject.Fax,
                EmailAddress = accountingObject.EmailAddress,
                Website = accountingObject.Website,
                Tel = accountingObject.Tel,
                CompanyTaxCode = accountingObject.CompanyTaxCode,
                BirthDate = accountingObject.BirthDate,
                FiredDate = accountingObject.FiredDate,
                Description = accountingObject.Description,
                ContactName = accountingObject.ContactName,
                JobCandidateName = accountingObject.JobCandidateName,
                ContactSex = accountingObject.ContactSex,
                ContactMobile = accountingObject.ContactMobile,
                ContactEmail = accountingObject.ContactEmail,
                ContactHomeTel = accountingObject.ContactHomeTel,
                ContactAddress = accountingObject.ContactAddress,
                IsPersonal = accountingObject.IsPersonal,
                IdentificationNumber = accountingObject.IdentificationNumber,
                IssueDate = accountingObject.IssueDate,
                IssueBy = accountingObject.IssueBy,
                IsVendor = accountingObject.IsVendor,
                IsCustomer = accountingObject.IsCustomer,
                IsEmployess = accountingObject.IsEmployess,
                CountryRegion = accountingObject.CountryRegion,
                Province = accountingObject.Province,
                District = accountingObject.District,
                Village = accountingObject.Village,
                IsActive = accountingObject.IsActive,
                DepartmentID = accountingObject.DepartmentID
            };
        }

        public static AccountingObjectCategoryDto ToDataTransferObject(AccountingObjectCategory accountingObjectCategory)
        {
            if (accountingObjectCategory == null) return null;

            return new AccountingObjectCategoryDto
            {
                AccountingObjectCategoryID = accountingObjectCategory.AccountingObjectCategoryID,
                AccountingObjectCategoryCode = accountingObjectCategory.AccountingObjectCategoryCode,
                AccountingObjectCategoryName = accountingObjectCategory.AccountingObjectCategoryName,
                ParentID = accountingObjectCategory.ParentID,
                IsParent = accountingObjectCategory.IsParent,
                RestaurantID = accountingObjectCategory.RestaurantID,
                Description = accountingObjectCategory.Description,
                IsActive = accountingObjectCategory.IsActive,
                IsCustomer = accountingObjectCategory.IsCustomer,
                IsVendor = accountingObjectCategory.IsVendor,
                IsEmployee = accountingObjectCategory.IsEmployee
            };
        }

        public static InventoryItemCategoryDto ToDataTransferObject(InventoryItemCategory inventoryItemCategory)
        {
            if (inventoryItemCategory == null) return null;

            return new InventoryItemCategoryDto
            {
                InventoryCategoryID = inventoryItemCategory.InventoryCategoryID,
                InventoryCategoryCode = inventoryItemCategory.InventoryCategoryCode,
                InventoryCategoryName = inventoryItemCategory.InventoryCategoryName,
                ParentID = inventoryItemCategory.ParentID,
                IsParent = inventoryItemCategory.IsParent,
                RestaurantID = inventoryItemCategory.RestaurantID,
                IsMaterial = inventoryItemCategory.IsMaterial,
                Description = inventoryItemCategory.Description,
                IsActive = inventoryItemCategory.IsActive
            };
        }

        public static DepartmentDto ToDataTransferObject(Department department)
        {
            if (department == null) return null;

            return new DepartmentDto
            {
                DepartmentID = department.DepartmentID,
                DepartmentCode = department.DepartmentCode,
                DepartmentName = department.DepartmentName,
                Description = department.Description,
                IsActive = department.IsActive,
                IsParent = department.IsParent,
                ParentDepartmentID = department.ParentDepartmentID,
                RestaurantId = department.RestaurantId
            };
        }

        public static RestaurantArea FromDataTransferObject(RestaurantAreaDto c)
        {
            if (c == null) return null;

            return new RestaurantArea
            {
                RestaurantAreaID = c.RestaurantAreaID,
                RestaurantAreaCode = c.RestaurantAreaCode,
                RestaurantAreaName = c.RestaurantAreaName,
                RestaurantID = c.RestaurantID,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static GeneralLedger FromDataTransferObject(GeneralLedgerDto c)
        {
            if (c == null) return null;

            return new GeneralLedger
            {
                GeneralLedgerID = c.GeneralLedgerID,
                RefID = c.RefID,
                RefDetailID = c.RefDetailID,
                RefType = c.RefType,
                RefNo = c.RefNo,
                RefDate = c.RefDate,
                PostedDate = c.PostedDate,
                CurrencyID = c.CurrencyID,
                AccountingObjectID = c.AccountingObjectID,
                DescriptionMaster = c.DescriptionMaster,
                DescriptionDetail = c.DescriptionDetail,
                Amount = c.Amount,
                RestaurantID = c.RestaurantID
            };
        }

        public static AutoID FromDataTransferObject(AutoIDDto c)
        {
            if (c == null) return null;

            return new AutoID
            {
                AutoId = c.AutoId,
                RefTypeID = c.RefTypeID,
                RefTypeName = c.RefTypeName,
                Prefix = c.Prefix,
                Value = c.Value,
                LengthOfValue = c.LengthOfValue,
                Suffix = c.Suffix,
                RestaurantID = c.RestaurantID,
            };
        }

        public static TimeSheetSign FromDataTransferObject(TimeSheetSignDto c)
        {
            if (c == null) return null;

            return new TimeSheetSign
            {
                TimeSheetSignID = c.TimeSheetSignID,
                TimeSheetSignCode = c.TimeSheetSignCode,
                TimeSheetSignName = c.TimeSheetSignName,
                SalaryRate = c.SalaryRate,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static UserGroup FromDataTransferObject(UserGroupDto c)
        {
            if (c == null) return null;

            return new UserGroup
            {
                UserGroupID = c.UserGroupID,
                UserGroupName = c.UserGroupName,
                Image = c.Image,
                RestaurantID = c.RestaurantID,
                CreateBy = c.CreateBy,
                CreateDate = c.CreateDate,
                ModifiedBy = c.ModifiedBy,
                ModifiedDate = c.ModifiedDate,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static InwardOutwardDetail FromDataTransferObject(InwardOutwardDetailDto c)
        {
            if (c == null) return null;

            return new InwardOutwardDetail
            {
                RefDetailID = c.RefDetailID,
                RefID = c.RefID,
                RestaurantMenuID = c.RestaurantMenuID,
                InventoryItemID = c.InventoryItemID,
                InventoryItemName = c.InventoryItemName,
                Description = c.Description,
                StockID = c.StockID,
                UnitID = c.UnitID,
                UnitConvertID = c.UnitConvertID,
                Quantity = c.Quantity,
                QuantityConvert = c.QuantityConvert,
                UnitPrice = c.UnitPrice,
                UnitPriceConvert = c.UnitPriceConvert,
                Amount = c.Amount,
                AmountConvert = c.AmountConvert,
                OutwardPurpose = c.OutwardPurpose,
            };
        }

        public static CountryRegion FromDataTransferObject(CountryRegionDto c)
        {
            if (c == null) return null;

            return new CountryRegion
            {
                CountryRegionCode = c.CountryRegionCode,
                CountryRegionName = c.CountryRegionName,
                CreateDate = c.CreateDate,
                ModifiedDate = c.ModifiedDate,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static ShipMethod FromDataTransferObject(ShipMethodDto c)
        {
            if (c == null) return null;

            return new ShipMethod
            {
                ShipMethodID = c.ShipMethodID,
                ShipCode = c.ShipCode,
                ShipName = c.ShipName,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static District FromDataTransferObject(DistrictDto c)
        {
            if (c == null) return null;

            return new District
            {
                DistrictCode = c.DistrictCode,
                DistrictName = c.DistrictName,
                CreateDate = c.CreateDate,
                ModifiedDate = c.ModifiedDate,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static Restaurant FromDataTransferObject(RestaurantDto c)
        {
            if (c == null) return null;

            return new Restaurant
            {
                RestaurantID = c.RestaurantID,
                RestaurantCode = c.RestaurantCode,
                RestaurantName = c.RestaurantName,
                Address = c.Address,
                PhoneNumber = c.PhoneNumber,
                Fax = c.Fax,
                Email = c.Email,
                Website = c.Website,
                TaxCode = c.TaxCode,
                IsActive = c.IsActive,
                IsAgencies = c.IsAgencies,
                Description = c.Description
            };
        }

        public static RestaurantTable FromDataTransferObject(RestaurantTableDto c)
        {
            if (c == null) return null;

            return new RestaurantTable
            {
                RestaurantTableID = c.RestaurantTableID,
                RestaurantTableCode = c.RestaurantTableCode,
                RestaurantTableName = c.RestaurantTableName,
                RestaurantID = c.RestaurantID,
                RestaurantAreaID = c.RestaurantAreaID,
                MaxPeople = c.MaxPeople,
                IsOrder = c.IsOrder,
                IsOrderOnline = c.IsOrderOnline,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static RestaurantMenuNorm FromDataTransferObject(RestaurantMenuNormDto restaurantMenuNorm)
        {
            if (restaurantMenuNorm == null) return null;

            return new RestaurantMenuNorm
            {
                MenuNormID = restaurantMenuNorm.MenuNormID,
                MenuNormCode = restaurantMenuNorm.MenuNormCode,
                MenuNormName = restaurantMenuNorm.MenuNormName,
                Description = restaurantMenuNorm.Description,
                RestaurantID = restaurantMenuNorm.RestaurantID,
                MenuID = restaurantMenuNorm.MenuID
            };
        }

        public static Unit FromDataTransferObject(UnitsDto c)
        {
            if (c == null) return null;

            return new Unit
            {
                UnitID = c.UnitID,
                UnitCode = c.UnitCode,
                UnitName = c.UnitName,
                RestaurantID = c.RestaurantID,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static InwardOutward FromDataTransferObject(InwardOutwardDto c)
        {
            if (c == null) return null;

            return new InwardOutward
            {
                RefID = c.RefID,
                RefType = c.RefType,
                RefDate = c.RefDate,
                PostedDate = c.PostedDate,
                RefNo = c.RefNo,
                EmployeeID = c.EmployeeID,
                AccountingObjectID = c.AccountingObjectID,
                AccountingObjectName = c.AccountingObjectName,
                AccountingObjectAddress = c.AccountingObjectAddress,
                JournalMemo = c.JournalMemo,
                CurrencyID = c.CurrencyID,
                ExchangeRate = c.ExchangeRate,
                IsImportPurchase = c.IsImportPurchase,
                ShippingMethodID = c.ShippingMethodID,
                TotalAmount = c.TotalAmount,
                RestaurantID = c.RestaurantID,
                IsPosted = c.IsPosted,
                IsMaterial = c.IsMaterial
            };
        }

        public static Stock FromDataTransferObject(StockDto c)
        {
            if (c == null) return null;

            return new Stock
            {
                StockID = c.StockID,
                StockCode = c.StockCode,
                StockName = c.StockName,
                RestaurantID = c.RestaurantID,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static Province FromDataTransferObject(ProvinceDto c)
        {
            if (c == null) return null;

            return new Province
            {
                ProvinceCode = c.ProvinceCode,
                ProvinceName = c.ProvinceName,
                CreateDate = c.CreateDate,
                ModifiedDate = c.ModifiedDate,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static AccountingObjectCategory FromDataTransferObject(AccountingObjectCategoryDto c)
        {
            if (c == null) return null;

            return new AccountingObjectCategory
            {
                AccountingObjectCategoryID = c.AccountingObjectCategoryID,
                AccountingObjectCategoryCode = c.AccountingObjectCategoryCode,
                AccountingObjectCategoryName = c.AccountingObjectCategoryName,
                ParentID = c.ParentID,
                IsParent = c.IsParent,
                IsCustomer = c.IsCustomer,
                IsVendor = c.IsVendor,
                IsEmployee = c.IsEmployee,
                RestaurantID = c.RestaurantID,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static AccountingObject FromDataTransferObject(AccountingObjectDto c)
        {
            if (c == null) return null;

            return new AccountingObject
            {
                AccountingObjectID = c.AccountingObjectID,
                AccountingObjectCode = c.AccountingObjectCode,
                AccountingObjectName = c.AccountingObjectName,
                AccountingObjectCategoryId = c.AccountingObjectCategoryId,
                RestaurantId = c.RestaurantId,
                Prefix = c.Prefix,
                Address = c.Address,
                Fax = c.Fax,
                EmailAddress = c.EmailAddress,
                Tel = c.Tel,
                Website = c.Website,
                CompanyTaxCode = c.CompanyTaxCode,
                BirthDate = c.BirthDate,
                FiredDate = c.FiredDate,
                Description = c.Description,
                ContactName = c.ContactName,
                JobCandidateName = c.JobCandidateName,
                ContactSex = c.ContactSex,
                ContactMobile = c.ContactMobile,
                ContactEmail = c.ContactEmail,
                ContactHomeTel = c.ContactHomeTel,
                ContactAddress = c.ContactAddress,
                IsPersonal = c.IsPersonal,
                IdentificationNumber = c.IdentificationNumber,
                IssueDate = c.IssueDate,
                IssueBy = c.IssueBy,
                IsVendor = c.IsVendor,
                IsCustomer = c.IsCustomer,
                IsEmployess = c.IsEmployess,
                CountryRegion = c.CountryRegion,
                Province = c.Province,
                District = c.District,
                Village = c.Village,
                IsActive = c.IsActive,
                DepartmentID = c.DepartmentID
            };
        }

        public static InventoryItemCategory FromDataTransferObject(InventoryItemCategoryDto c)
        {
            if (c == null) return null;

            return new InventoryItemCategory
            {
                InventoryCategoryID = c.InventoryCategoryID,
                InventoryCategoryCode = c.InventoryCategoryCode,
                InventoryCategoryName = c.InventoryCategoryName,
                ParentID = c.ParentID,
                IsParent = c.IsParent,
                IsMaterial = c.IsMaterial,
                RestaurantID = c.RestaurantID,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static InventoryLedger FromDataTransferObject(InventoryLedgerDto c)
        {
            if (c == null) return null;

            return new InventoryLedger
            {
                InventoryLedgerID= c.InventoryLedgerID,
                RefID= c.RefID,
                RefType= c.RefType,
                RefDate= c.RefDate,
                PostedDate= c.PostedDate,
                RefNo= c.RefNo,
                RefDetailID= c.RefDetailID,
                StockID= c.StockID,
                InventoryItemID= c.InventoryItemID,
                RestaurantMenuID= c.RestaurantMenuID,
                Unit= c.Unit,
                UnitPrice= c.UnitPrice,
                InwardQuantity= c.InwardQuantity,
                OutwardQuantity= c.OutwardQuantity,
                InwardAmount= c.InwardAmount,
                OutwardAmount= c.OutwardAmount,
                JournalMemo= c.JournalMemo,
                Description= c.Description,
                OutwardPurpose= c.OutwardPurpose,
                RestaurantID= c.RestaurantID
            };
        }

        public static InventoryItem FromDataTransferObject(InventoryItemDto c)
        {
            if (c == null) return null;

            return new InventoryItem
            {
                InventoryItemID = c.InventoryItemID,
                InventoryCategoryID = c.InventoryCategoryID,
                InventoryItemCode = c.InventoryItemCode,
                InventoryItemName = c.InventoryItemName,
                UnitID = c.UnitID,
                UnitPrice = c.UnitPrice,
                SalesPrice = c.SalesPrice,
                StockID = c.StockID,
                MinimumStock = c.MinimumStock,
                IsActive = c.IsActive,
                Description = c.Description,
                RestaurantId = c.RestaurantId,
                IsMaterial = c.IsMaterial
            };
        }

        public static RestaurantMenuCategory FromDataTransferObject(RestaurantMenuCategoryDto c)
        {
            if (c == null) return null;

            return new RestaurantMenuCategory
            {
                MenuCategoryID = c.MenuCategoryID,
                MenuCategoryCode = c.MenuCategoryCode,
                MenuCategoryName = c.MenuCategoryName,
                RestaurantID = c.RestaurantID,
                IsParent = c.IsParent,
                ParentID = c.ParentID,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static RestaurantMenu FromDataTransferObject(RestaurantMenuDto c)
        {
            if (c == null) return null;
            return new RestaurantMenu
            {
                MenuID = c.MenuID,
                MenuCode = c.MenuCode,
                MenuName = c.MenuName,
                Description = c.Description,
                UnitID = c.UnitID,
                SalesPrice = c.SalesPrice,
                MenuImage = c.MenuImage,
                IsActive = c.IsActive,
                IsNorm = c.IsNorm,
                RestaurantID = c.RestaurantID,
                MenuCategoryID = c.MenuCategoryID
            };
        }

        public static RestaurantMenuNormDetail FromDataTransferObject(RestaurantMenuNormDetailDto c)
        {
            if (c == null) return null;
            return new RestaurantMenuNormDetail
            {
                MenuNormDetailID = c.MenuNormDetailID,
                MenuNormID = c.MenuNormID,
                InventoryItemID = c.InventoryItemID,
                InventoryItemName = c.InventoryItemName,
                UnitID = c.UnitID,
                UnitPrice = c.UnitPrice,
                RestaurantID = c.RestaurantID,
                Quantity = c.Quantity
            };
        }

        public static Currency FromDataTransferObject(CurrencyDto c)
        {
            if (c == null) return null;

            return new Currency
            {
                CurrencyID = c.CurrencyID,
                CurrencyCode = c.CurrencyCode,
                CurrencyName = c.CurrencyName,
                Description = c.Description,
                IsActive = c.IsActive
            };
        }

        public static Department FromDataTransferObject(DepartmentDto c)
        {
            if (c == null) return null;

            return new Department
            {
                DepartmentID = c.DepartmentID,
                DepartmentCode = c.DepartmentCode,
                DepartmentName = c.DepartmentName,
                Description = c.Description,
                IsActive = c.IsActive,
                IsParent = c.IsParent,
                ParentDepartmentID = c.ParentDepartmentID,
                RestaurantId = c.RestaurantId
            };
        }
    }
}